﻿using System;
using System.Data;
using Jayden.Dll.Core.Persistence.Models;
using Jayden.Dll.Core.Persistence.Queries;
using System.Collections.Generic;

namespace Jayden.Dll.Core.Persistence
{
	public interface DataAccess : IDisposable
	{
		Configuration Configuration { get; }
		Entity Entity { get; }
		UnitOfWork UnitOfWork { get; }

		void Create(Object obj);
		Object Read(ObjectId id);
		void Update(Object obj);
		void Delete(ObjectId id);

		DataTable Read(Query query, Dictionary<string, object> parameters = null);


		void BeginTransaction();
		void CommitTransaction();
		void RollbackTransaction();
	}
	public interface DataAccess<T> : DataAccess where T : Object
	{
		void Create(T obj);
		new T Read(ObjectId id);
		void Update(T obj);
	}
}
